package com.bifrost.model.param;

import com.bifrost.validator.group.UserAdd;
import com.bifrost.validator.group.UserUpdate;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * Author by yanxiaobo
 * Date on 2018/4/18$.
 */
@Getter
@Setter
public class UserParam {
    @NotNull(message = "更新用户必须指定具体的用户",groups = UserUpdate.class)
    private Long id;

    @NotBlank(message = "用户名为必填字段",groups = {UserUpdate.class, UserAdd.class})
    @Length(max = 100,message = "用户名必须在100个字符以内",groups = {UserAdd.class,UserUpdate.class})
    private String adminName;

    /*@Pattern(regexp = "^[1](([3][0-9])|([4][5,7,9])|([5][^4,6,9])|([6][6])|([7][3,5,6,7,8])|([8][0-9])|([9][8,9]))[0-9]{8}$",
            message = "请正确填写电话号码",
            groups = {UserAdd.class,UserUpdate.class})*/
    private String adminPhone;

    @NotBlank(message = "密码为必填字段",groups = {UserAdd.class,UserUpdate.class})
    private String adminPassword;

    @Length(max = 255,message = "备注字段必须在255个字符以内",groups = {UserAdd.class,UserUpdate.class})
    private String description;

    private boolean active = true;

}
